import 'package:enterprise_v6_app/app/components/custom_refresh.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/application/Inventory_system/daily_inspection_checklist_entity.dart';

///检查项清单
class DailyChecklistController extends GetxController {
  /// 列表刷新key
  final GlobalKey<CustomEasyRefreshListState> globalKey = GlobalKey();

  /// 获取数据
  Future<List<DailyInspectionChecklistEntity>> checklist(int index, int size, {String? search}) async {
    final res = await HttpUtil().generateGetRequest<List<DailyInspectionChecklistEntity>>(
      Interface.checklist,
      queryParameters: {
        'pageNum': index,
        'pageSize': size,
        'id': Get.arguments, //	措施id
      },
    ).execute();
    List<DailyInspectionChecklistEntity>? list = [];
    res.onSuccess((result) {
      if (result.data != null) {
        list = result.data;
      }
    });
    return list!;
  }
}
